<?php

class Admin_Model_Layout {
	public $Id;
	public $Layout;
	public $Name;
	
	public function __construct($options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }
	public function __set($name, $value)
    {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid property');
        }
        $this->$method($value);
    }

    public function __get($name)
    {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid property');
        }
        return $this->$method();
    }
    
	public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
	public function setId($id) {$this->Id = $id; return $this;}
	public function setName($name) {$this->Name = $name; return $this;}
	public function setLayout($value){$this->Layout = $value; return $this;}
	public function getId() {return $this->Id;}
	public function getName() {return $this->Name;}
	public function getLayout() {return $this->Layout;}
}

?>